package com.dcloud.mq.config;

import lombok.Data;
import org.apache.rocketmq.common.protocol.heartbeat.MessageModel;
import org.apache.rocketmq.spring.annotation.SelectorType;

import java.io.Serializable;

@Data
public class ConsumerConfig implements Serializable {
    private static final long serialVersionUID = 2964721134699192490L;

    /**
     * 订阅主题
     * @return
     */
    private String topic;

    /**
     * 消费者组
     * @return
     */
    private String consumerGroup;

    /**
     * 默认是tag，订阅子查询条件，默认获取所有
     * 如果selectorType为sql，则值为sql
     * @return
     */
    private String selectorExpression = "*";

    /**
     * 查询类型 SelectorType.TAG根据tag查询   SelectorType.SQL92根据sql查询
     * @return
     */
    private SelectorType selectorType;

    /**
     * 控制消息模式，如果希望所有订阅者都接收消息全部消息，广播是一个不错的选择。如果希望一个消费者接收则使用负载均衡模式
     * Control message mode, if you want all subscribers receive message all message, broadcasting is a good choice.
     * @return
     */
    private MessageModel messageModel;

    /**
     * 实例名称
     * @return
     */
    private String instanceName;
}
